-
Notifications
You must be signed in to change notification settings - Fork 445
Improve URLSearchParams constructor type definition #2070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree |
Thanks for the PR! This section of the codebase is owned by @saschanaz - if they write a comment saying "LGTM" then it will be merged. |
You need to have cloned the submodule as well.
|
This is blocked by #222 because microsoft/TypeScript#3538 could greatly help without all those separate libs but I don't see that coming anytime soon. |
ES5 is going to be deprecated, so maybe there's a future where it'd work out. |
Thanks @jakebailey, got it to generate and committed the changes. I am seeing the |
Correct, but we're likely making DOM imply ES6 and DOM.Iterable in 6.0 |
But will 6.0 remove ES5 completely? |
As a target for emit, yes, at least deprecated. The rest is more a product of us wanting to make DOM.Iterable auto included, but that means we need Symbol, which means ES6, or at least the es6 symbol libs. It isn't really clean to do, so still figuring it out. |
Actually, why isn't this being stuck into the iterable d.ts file? |
I can add or feel free to edit as well! I'm not sure exactly which file you are referencing. Should it be added to the generated file here as the call signature? https://github.com/microsoft/TypeScript-DOM-lib-generator/blob/main/baselines/dom.iterable.generated.d.ts#L400 |
Because we can't override constructors without having #222 first. |
For 6.0, we're going to make the DOM types Though, why isn't this a Constructor type instead of a named interface that can be merged into, like we do Map and such? |
You mean defining a separate interface? Because that'll pollute the global namespace 2x than we do now... |
Yes, since that's what we do in the main libs, but I suppose that would be pretty noisy. |
Overrides the type of
URLSearchParams
init to accept aIterable<[string, string]>
instead ofstring[][]
.MDN Reference
For example:
is valid, but currently shows an error.
There was an added type of
URLSearchParams
which I figured I should remove, theIterable<[string, string]>
type covers this case as well.